package com.hx.er.action.admin.user;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.hx.er.action.base.ErAdminPageAction;
import com.hx.er.bean.base.UserBean;
import com.hx.er.bean.detail.UserDetailBean;
import com.hx.er.service.admin.IAdminUserService;

/**
 * @author HX
 * 
 */
public class AdminUserListAction extends ErAdminPageAction {
	// 序列化ID
	private static final long serialVersionUID = 4926512300151605899L;

	private UserBean userBeanPage;
	private List<UserDetailBean> userDetailList;
	private int userCount;

	@Autowired
	private IAdminUserService adminUserService;

	public String init() {
		// 基本检索条件获取
		Map<String, Object> conditions = super.getConditionMap();

		// 查询用户列表
		this.userDetailList = this.adminUserService.getUserDetailList(conditions);
		// 查询用户总数
		this.userCount = this.adminUserService.getUserDetailCount(conditions);
		super.pageCount = (int) Math.ceil(this.userCount / (double) dataListLimit);

		return SUCCESS;
	}

	public UserBean getUserBeanPage() {
		return userBeanPage;
	}

	public void setUserBeanPage(UserBean userBeanPage) {
		this.userBeanPage = userBeanPage;
	}

	public List<UserDetailBean> getUserDetailList() {
		return userDetailList;
	}

	public void setUserDetailList(List<UserDetailBean> userDetailList) {
		this.userDetailList = userDetailList;
	}

	public int getUserCount() {
		return userCount;
	}

	public void setUserCount(int userCount) {
		this.userCount = userCount;
	}
}
